import 'package:flutter/material.dart';

import '../services/screen_adapter.dart';

class MqText extends StatelessWidget {

  final String text;
  final bool password;
  final Object onChange;
  final int maxLines;
  final double height;
  final TextEditingController controller;

  MqText({Key key, this.text='输入内容', this.password = false, this.onChange, this.maxLines=1, this.height=68, this.controller}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    ScreenAdapter.init();

    return Container(
      height: ScreenAdapter.height(height),
      decoration: BoxDecoration(
        // color: Color.fromRGBO(233, 233, 233, 0.8),
        // borderRadius: BorderRadius.circular(30)
        border: Border(
          bottom: BorderSide(
            width: 1,
            color: Colors.black12
          )
        )
      ),
      child: TextField(
        controller: controller,
        maxLines: maxLines,
        obscureText: password,
        // autofocus: true,
        decoration: InputDecoration(
          hintText: text,
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(30),
            borderSide: BorderSide.none
          )
        ),
        onChanged: onChange
        
      ),
    );
  }
}